//
//  RegisterOrLoginViewController.m
//  ChatForHot
//
//  Created by FLY on 2018/10/10.
//  Copyright © 2018年 FLY. All rights reserved.
//

#import "RegisterOrLoginViewController.h"
#import "RegisterViewController.h"
#import "LoginViewController.h"

@interface RegisterOrLoginViewController ()

@end

@implementation RegisterOrLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.isHiddenNav = YES;
}
- (void)HOTCHATInsertSubViews{
    
    [self.view addSubview:self.HOTCHATbackImgView];
    [self.view addSubview:self.HOTCHATlogoImgView];
    [self.view addSubview:self.HOTCHATregisterBtn];
    [self.view addSubview:self.HOTCHATloginBtn];
    
    
    [self.HOTCHATbackImgView mas_updateConstraints:^(MASConstraintMaker *make) {
       
        make.edges.equalTo(self.view);
    }];
    [self.HOTCHATlogoImgView mas_updateConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.view).mas_offset(140);
        make.centerX.equalTo(self.view);
    }];
    [self.HOTCHATregisterBtn mas_updateConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.view.mas_left).mas_offset(30);
        make.right.mas_equalTo(self.view.mas_right).mas_offset(-30);
        make.bottom.mas_equalTo(self.HOTCHATloginBtn.mas_top).mas_offset(-25);
    }];
    [self.HOTCHATloginBtn mas_updateConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.view.mas_left).mas_offset(30);
        make.right.mas_equalTo(self.view.mas_right).mas_offset(-30);
        make.bottom.mas_equalTo(self.view.mas_bottom).mas_offset(-54);
    }];
}

//lazzy
- (UIImageView *)HOTCHATbackImgView{
    
    if (_HOTCHATbackImgView == nil) {
        
        _HOTCHATbackImgView = [[UIImageView alloc]init];
        _HOTCHATbackImgView.image = [UIImage imageNamed:@"l_bg"];
    }
    return _HOTCHATbackImgView;
}
-(UIImageView *)HOTCHATlogoImgView{
    
    if (_HOTCHATlogoImgView == nil) {
        
        _HOTCHATlogoImgView = [[UIImageView alloc]init];
        _HOTCHATlogoImgView.image = [UIImage imageNamed:@"l_bg_top_logo"];
    }
    return _HOTCHATlogoImgView;
}
- (UIButton *)HOTCHATregisterBtn{
    
    if (_HOTCHATregisterBtn == nil) {
        
        _HOTCHATregisterBtn = [[UIButton alloc]init];
        [_HOTCHATregisterBtn setBackgroundImage:[[UIImage imageNamed:@"l_btn_signup"] resizableImageWithCapInsets:UIEdgeInsetsMake(1, 20, 1, 20) resizingMode:(UIImageResizingModeStretch)] forState:UIControlStateNormal];
        [_HOTCHATregisterBtn setBackgroundImage:[[UIImage imageNamed:@"l_btn_signup_hig"] resizableImageWithCapInsets:UIEdgeInsetsMake(1, 20, 1, 20) resizingMode:(UIImageResizingModeStretch)] forState:UIControlStateHighlighted];
        [_HOTCHATregisterBtn setTitleColor:HOTCHATMainColor forState:UIControlStateNormal];
        [_HOTCHATregisterBtn setTitle:NSLocalizedString(@"StrN04", nil) forState:UIControlStateNormal];
        [_HOTCHATregisterBtn addTarget:self action:@selector(HOTCHATgoRegisterAction) forControlEvents:UIControlEventTouchUpInside];
        _HOTCHATregisterBtn.titleLabel.font = [UIFont systemFontOfSize:18];
        
    }
    return _HOTCHATregisterBtn;
}
- (UIButton *)HOTCHATloginBtn{
    
    if (_HOTCHATloginBtn == nil) {
        
        _HOTCHATloginBtn = [[UIButton alloc]init];
        [_HOTCHATloginBtn setBackgroundImage:[[UIImage imageNamed:@"l_btn_login"] resizableImageWithCapInsets:UIEdgeInsetsMake(1, 20, 1, 20) resizingMode:(UIImageResizingModeStretch)] forState:UIControlStateNormal];
        [_HOTCHATloginBtn setBackgroundImage:[[UIImage imageNamed:@"l_btn_login_hig"] resizableImageWithCapInsets:UIEdgeInsetsMake(1, 20, 1, 20) resizingMode:(UIImageResizingModeStretch)] forState:UIControlStateHighlighted];
        [_HOTCHATloginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_HOTCHATloginBtn setTitle:NSLocalizedString(@"StrN05", nil) forState:UIControlStateNormal];
        [_HOTCHATloginBtn addTarget:self action:@selector(HOTCHATgoLoginAction) forControlEvents:UIControlEventTouchUpInside];
        _HOTCHATloginBtn.titleLabel.font = [UIFont systemFontOfSize:18];
    }
    return _HOTCHATloginBtn;
}
- (void)HOTCHATgoRegisterAction{
    
    RegisterViewController *registerVC = [[RegisterViewController alloc]init];
    [self.navigationController pushViewController:registerVC animated:YES];
}
- (void)HOTCHATgoLoginAction{
    
    LoginViewController *loginVC = [[LoginViewController alloc]init];
    [self.navigationController pushViewController:loginVC animated:YES];
}
@end
